package com.mf.all.exception;

import com.mf.all.emuns.ResultCodeEnum;
import lombok.Getter;

/**
 * @Author: lmf
 * @Create: 2025/3/8 20:44
 * Description:  api接口异常封装
 */
@Getter
public class ApiException extends RuntimeException{
    final private Integer code;

    public ApiException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public ApiException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    public ApiException(String message){
        super(message);
        this.code = ResultCodeEnum.ERROR.getCode();
    }
}
